package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.product.client.ProductFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author LEO
 * @Date 2021年12月14日 19:05
 */
@Controller
public class IndexController {

    @Autowired
    private ProductFeignClient productFeignClient;

//    @GetMapping("/")
    @GetMapping({"/","index.html"})
    public String index(HttpServletRequest request){
        Result result = productFeignClient.getBaseCategory();
        //存储一个list
        request.setAttribute("list",result.getData());
        return "index/index";
    }
}
